home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MISC.SWG / 0041_Convert REAL to INTEGER.pas < prev    next >
Pascal/Delphi Source File  |  1993-09-26  |  712b  |  23 lines

  1. {*****************************************************************************
  2.  * Function ...... RTOI()
  3.  * Purpose ....... To convert a real to an integer
  4.  * Parameters .... RealNum    Real type number
  5.  * Returns ....... The integer part of RealNum
  6.  * Notes ......... Simply truncates the decimals
  7.  *               . Uses function Left
  8.  * Author ........ Martin Richardson
  9.  * Date .......... May 13, 1992
  10.  *****************************************************************************}
  11. FUNCTION RTOI( RealNum: REAL ): LONGINT;
  12. VAR
  13.    s: STRING;
  14.    l: LONGINT;
  15.    i: INTEGER;
  16. BEGIN
  17.      STR( RealNum:17:2, s );
  18.      s := Left( s, LENGTH(s) - 3 );
  19.      VAL( s, l, i );
  20.      RTOI := l;
  21. END;
  22.  
  23.